import os
size = 0
def get_number(file_wanted):
    global size
    d_list = os.listdir(file_wanted)
    print(d_list)
    for file in d_list:
        file = os.path.join(file_wanted,file)
        print('this is file',file)
        if os.path.isfile(file):
            size=size+os.path.getsize(file)
            print(os.path.getsize(file))
        if os.path.isdir(file):
            get_number(file)
    return size
total_size= get_number('待检验路径')
print('Total amount:',total_size)